package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/mobile/setmeal")
public class MobileSetMealController {
    @Autowired
    private SetMealService  setMealService;
    /**
     * 手机端_体检预约_套餐展示
     * @return
     */
    @GetMapping("/getSetmeal")
    public Result getSetmeal(){
        List<Setmeal> setmealList = setMealService.selectGetSetmeal();
        return new Result(true, MessageConst.QUERY_SETMEAL_SUCCESS,setmealList);
    }

    /**
     * 套餐详情查看
     */
    @GetMapping("/findById")
    public Result findById(@RequestParam("id") Integer id){
       Setmeal setmeal = setMealService.findById(id);
       return new Result(true,MessageConst.QUERY_SETMEAL_SUCCESS,setmeal);
    }
}
